<template>
  <basic-container>
    <el-row>
      <h3>{{ schoolName }}</h3>
    </el-row>
    <div style="border-bottom: 5px solid #f0f0f0; margin-bottom: 20px" />
    <el-row v-if="isLoad">
      <el-col :span="6">
        <heartTab :educationDataObj="educationDataObj" :key="time" />
      </el-col>
      <el-col :span="12">
        <warningTab :educationDataObj="educationDataObj" />
      </el-col>
      <el-col :span="6">
        <heartWarningTab :educationDataObj="educationDataObj" />
      </el-col>
    </el-row>
  </basic-container>
</template>

<script>
import { mapGetters } from "vuex";
import heartTab from "./educationBorad/heartTab";
import warningTab from "./educationBorad/warningTab";
import heartWarningTab from "./educationBorad/heartWarningTab";
import {
  findALLNumEducation,
  findALLTestNumEducation,
  findAllGradeLevelInterveneNumEducation,
  findFinishNoTestNumEducation,
  findFinishTestNumEducation,
  findGradeLevelInterveneNumEducation,
  findGradeLevelNumEducation,
  findLevelAllNumEducation,
  findLevelAreaNumEducation,
  findLevelNumEducation,
  findLevelSexNumEducation,
  findSexLevelNumEducation,
  findAllGradeNoTestNumEducation,
  findGradeLevelNum1Education,
  totalTenantPostNumber,
} from "@/api/report/report";
import { getNewUserInfo } from "@/api/user";
export default {
  name: "thirdRegister",
  components: { heartTab, warningTab, heartWarningTab },
  data() {
    return {
      isLoad: false,
      schoolName: "",
      tenantId: "",
      projectId: "",
      time: "",
      projectOptions: [],
      educationDataObj: {},
    };
  },
  computed: {
    ...mapGetters(["userInfo"]),
  },
  created() {},
  mounted() {
    this.initData();
  },
  methods: {
    searchProjectData() {
      this.isLoad = false;
      this.initData();
    },
    initData() {
      let tenantId = JSON.parse(window.localStorage.getItem("saber-userInfo"))
        .content.tenantId;
      var _this = this; //注意！一定要重新定义一下this指向
      this.$axios
        .all([
          findALLNumEducation({ tenantId: tenantId }),
          findALLTestNumEducation({ tenantId: tenantId }),
          findAllGradeLevelInterveneNumEducation({ tenantId: tenantId }),
          findFinishNoTestNumEducation({ tenantId: tenantId }),
          findFinishTestNumEducation({ tenantId: tenantId }),
          findGradeLevelInterveneNumEducation({ tenantId: tenantId }),
          findGradeLevelNumEducation({ tenantId: tenantId }),
          findLevelAllNumEducation({ tenantId: tenantId }),
          findLevelAreaNumEducation({ tenantId: tenantId }),
          findLevelNumEducation({ tenantId: tenantId }),
          findLevelSexNumEducation({ tenantId: tenantId }),
          findSexLevelNumEducation({ tenantId: tenantId }),
          findAllGradeNoTestNumEducation({ tenantId: tenantId }),
          findGradeLevelNum1Education({ tenantId: tenantId }),
          getNewUserInfo({}),
          totalTenantPostNumber({ tenantId: tenantId, category: 2 }),
          totalTenantPostNumber({ tenantId: tenantId, category: 4 }),
        ])
        .then(
          _this.$axios.spread(function (
            res1,
            res2,
            res3,
            res4,
            res5,
            res6,
            res7,
            res8,
            res9,
            res10,
            res11,
            res12,
            res13,
            res14,
            res15,
            res16,
            res17
          ) {
            _this.educationDataObj.findALLNum = res1.data.data;
            _this.educationDataObj.findALLTestNum = res2.data.data;
            _this.educationDataObj.findAllGradeLevelInterveneNum =
              res3.data.data;
            _this.educationDataObj.findFinishNoTestNum = res4.data.data;
            _this.educationDataObj.findFinishTestNum = res5.data.data;
            _this.educationDataObj.findGradeLevelInterveneNum = res6.data.data;
            _this.educationDataObj.findGradeLevelNum = res7.data.data;
            _this.educationDataObj.findLevelAllNum = res8.data.data;
            _this.educationDataObj.findLevelAreaNum = res9.data.data;
            _this.educationDataObj.findLevelNum = res10.data.data;
            _this.educationDataObj.findLevelSexNum = res11.data.data;
            _this.educationDataObj.findSexLevelNum = res12.data.data;
            _this.educationDataObj.findAllGradeNoTestNum = res13.data.data;
            _this.educationDataObj.findGradeLevelNum1 = res14.data.data;
            _this.schoolName = res15.data.data.tenantName;
            _this.educationDataObj.totalTenantPostNumber = {};
            _this.educationDataObj.totalTenantPostNumber.teacherNum =
              res16.data.data;
            _this.educationDataObj.totalTenantPostNumber.studentNum =
              res17.data.data;
            _this.isLoad = true;
          })
        );
    },
    handleDown() {
      this.$router.push({
        name: "学校详情列表",
      });
    },
  },
};
</script>
<style lang="scss">
.tableTdCss {
  border: 1px solid white;
}
.headerCss {
  background: #29d;
  color: white;
}
.tableRowSingle {
  background: #ebeef5;
}
.tableRowDouble {
  background: #ecf5ff;
}
</style>
